import Vue from 'vue'
import Router from 'vue-router'
import Index from '@/view/Index.vue'

Vue.use(Router)
//解决同一个路由多次切换报错的问题
const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
};
export default new Router({
  routes: [
    {
      path: '/',
      name: 'Index',
      component: Index,
      //子路由
      children:[
        {path:'consultant',name:'Consultant',component:()=>import('../view/consultant/Index')},
        {path:'payment',name:'Payment',component:()=>import('../view/payment/Index')},
        {path:'student',name:'Student',component:()=>import('../view/student/Index')},
        {path:'studentscore',name:'StudentScoreInfo',component:()=>import('../view/studentscore/StudentScoreInfo')},
        {path:'employment',name:'Employment',component:()=>import('../view/employment/Index')},
        {path:'studentInfo',name:'StudentInfo',component:()=>import('../view/student/StudentInfo')},
        {path:'accommodation',name:'Accommodation',component:()=>import('../view/accommodation/Index')},
        {path:'classes',name:'Classes',component:()=>import('../view/classes/Index')},
        {path:'employee',name:'Employee',component:()=>import('../view/employee/Index')},
        {path:'paymentType',name:'PaymentType',component:()=>import('../view/paymenttype/Index')},
        {path:'role',name:'Role',component:()=>import('../view/role/Index')},
        {path:'login',name:'Login',component:()=>import('../view/login/Index')},
      ]
    }
  ]
})
